package development.hdk.mindmapfornandroid;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class IconAdapter extends BaseAdapter
{
  int colorGridColumnWidth;
  private Context context;
  String[] icons;

  public IconAdapter(Context paramContext)
  {
    this.context = paramContext;
    this.colorGridColumnWidth = Math.round(paramContext.getResources().getDimension(2131099650));
    this.icons = paramContext.getResources().getStringArray(2131034113);
  }

  public static int calculateInSampleSize(BitmapFactory.Options paramOptions, int paramInt1, int paramInt2)
  {
    int i = paramOptions.outHeight;
    int j = paramOptions.outWidth;
    int k = 1;
    if ((i > paramInt2) || (j > paramInt1))
      if (j > i)
       {for (k = Math.round(i / paramInt2); ; k = Math.round(j / paramInt1));}
    //Co fix
      return k;
  }

  public static Bitmap decodeSampledBitmapFromResource(Resources paramResources, int paramInt1, int paramInt2, int paramInt3)
  {
    BitmapFactory.Options localOptions = new BitmapFactory.Options();
    localOptions.inJustDecodeBounds = true;
    BitmapFactory.decodeResource(paramResources, paramInt1, localOptions);
    localOptions.inSampleSize = calculateInSampleSize(localOptions, paramInt2, paramInt3);
    localOptions.inJustDecodeBounds = false;
    return BitmapFactory.decodeResource(paramResources, paramInt1, localOptions);
  }

  public int getCount()
  {
    return this.icons.length;
  }

  public Object getItem(int paramInt)
  {
    return null;
  }

  public long getItemId(int paramInt)
  {
    return 0L;
  }

  public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
  {
    ImageView localImageView = null;
    if (paramView == null)
    {
      localImageView = new ImageView(this.context);
      localImageView.setLayoutParams(new AbsListView.LayoutParams(this.colorGridColumnWidth, this.colorGridColumnWidth));
    }
    while (true)
    {
      localImageView.setFocusable(false);
      int i = this.context.getResources().getIdentifier(this.icons[paramInt], "drawable", this.context.getPackageName());
      localImageView.setImageBitmap(decodeSampledBitmapFromResource(this.context.getResources(), i, (int)TypedValue.applyDimension(1, this.colorGridColumnWidth, this.context.getResources().getDisplayMetrics()), (int)TypedValue.applyDimension(1, this.colorGridColumnWidth, this.context.getResources().getDisplayMetrics())));
      localImageView.setId(paramInt);
      localImageView = (ImageView)paramView;
      return localImageView;
      
    }
  }
}

/* Location:           D:\APKtoJava_RC2\tools\classes-dex2jar.jar
 * Qualified Name:     com.qdvsoftworks.schematicmind.dialogs.IconAdapter
 * JD-Core Version:    0.6.0
 */